package com.zx.cashiersystem.mvp.presenter;

import android.content.Context;

import com.zx.cashiersystem.entitys.OrderInfo;
import com.zx.cashiersystem.mvp.model.OnResultListener;
import com.zx.cashiersystem.mvp.model.OrderLeftModelImpl;
import com.zx.cashiersystem.mvp.view.OrderLeftView;

import java.util.List;

/**
 * Created by Administrator on 2017/2/10.
 */

public class OrderLeftPrestener implements OnResultListener {
    private OrderLeftView orderLeftView;
    private Context context;
    private OrderLeftModelImpl orderLeftModel;

    public OrderLeftPrestener(OrderLeftView orderLeftView, Context context) {
        this.orderLeftView = orderLeftView;
        this.context = context;
        orderLeftModel = new OrderLeftModelImpl();;
    }
    public void getFromNet(){
        orderLeftModel.getFromNet(0,context,this,null);
    }

    @Override
    public void onSuccess(int requestCode, String str) {

    }

    @Override
    public void onAlert(int requestCode, String str) {
        List<OrderInfo> list = orderLeftModel.asyncJson(str);
        orderLeftView.onSuccess(list);
    }

    @Override
    public void onFailure(int requestCode, String str) {
            orderLeftView.onFial(str);
    }
}
